package com.ljfiction.book.adapter;

import android.graphics.Color;
import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ljfiction.book.Baner.BiaoqianmoreBean;
import com.ljfiction.book.R;
import com.ljfiction.book.tools.ScreenUtils;
import com.ljfiction.book.tools.StringTool;
import com.zhy.autolayout.utils.AutoUtils;

import java.util.List;

/**
 * Created by Android on 2017/10/14.
 */

public class MoreBiaoqianAdapter extends BaseQuickAdapter<BiaoqianmoreBean.DataBean.ListBean,BaseViewHolder> {
    public MoreBiaoqianAdapter(@LayoutRes int layoutResId, @Nullable List<BiaoqianmoreBean.DataBean.ListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, BiaoqianmoreBean.DataBean.ListBean item) {
        AutoUtils.autoSize(helper.itemView);
         Glide.with(mContext).load(item.getBookImage()).into((ImageView) helper.getView(R.id.bookimage_morexiaobian));
        helper.setText(R.id.bookname_morexiaobian,item.getBookName())
                .setText(R.id.clicknum_morexiaobian, StringTool.getClicknum(item.getClickTotal())+"点击")
                .setText(R.id.writername_morexiaobian,"作者: "+item.getWriterName())
                .setText(R.id.bookcomment_morexiaobian,item.getBookIntroduction());
        (helper.getView(R.id.booklable_morexiaobian)).setVisibility(View.GONE);
        helper.getView(R.id.bookclassname_morexiaobian).setVisibility(View.GONE);
        helper.getView(R.id.morexiaobian_view2).setVisibility(View.GONE);
        if(item.getBookStatus()==1){
            helper.setText(R.id.zhuatai_morexiaobian,"已完结").setTextColor(R.id.zhuatai_morexiaobian, Color.parseColor("#FF6F00"));
        }else {
            helper.setText(R.id.zhuatai_morexiaobian,"连载中").setTextColor(R.id.zhuatai_morexiaobian, Color.parseColor("#47B2D8"));
        }
    }
}
